import dict from '@/const/dict/dict';
import date from '@/const/date/date';

export default {
  height: 'auto',
  calcHeight: 30,
  tip: false,
  searchShow: true,
  border: true,
  index: true,
  viewBtn: true,
  selection: true,
  dialogClickModal: false,
  grid: false,
  gridBtn: false,
  dialogDrag: true,
  defaultSort: {
    prop: 'createTime',
    order: 'descending'
  },
  column: [
    {
      label: '主键',
      prop: 'id',
      type: 'input',
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true
    },
    {
      label: '接码平台',
      prop: 'serviceApiId',
      type: 'select',
      dicUrl: '/biz/search/select/sms-api',
      dicHeaders: { crypto: true },
      dicMethod: 'post',
      dataType: 'string',
      props: {
        label: 'dictValue',
        value: 'dictKey'
      },
      search: true,
      searchSpan: 4,
      searchLabelWidth: 100,
      virtualize: true,
      width: 110,
      overHidden: true
    },
    {
      label: '平台配置',
      prop: 'serviceConfigId',
      component: 'sms-service-select',
      params: {
        checkType: 'radio'
      },
      search: true,
      searchSpan: 4,
      searchLabelWidth: 100,
      hide: true
    },
    {
      label: '国家',
      prop: 'countryId',
      type: 'select',
      dicUrl: '/biz/search/select/country',
      dicHeaders: { crypto: true },
      dicMethod: 'post',
      dataType: 'string',
      props: {
        label: 'dictValue',
        value: 'dictKey'
      },
      search: true,
      searchSpan: 4,
      searchLabelWidth: 75,
      filterable: true,
      virtualize: true,
      width: 180
    },
    {
      label: '激活ID',
      prop: 'activationId',
      type: 'input',
      hide: true
    },
    {
      label: '号码',
      prop: 'activationPhone',
      type: 'input',
      search: true,
      searchSpan: 4,
      searchLabelWidth: 75,
      width: 150
    },
    {
      label: '费用',
      prop: 'activationCost',
      type: 'input'
    },
    {
      label: '运营商',
      prop: 'activationOperator',
      type: 'input',
      overHidden: true
    },
    {
      label: '设备类型',
      prop: 'deviceType',
      type: 'select',
      dicUrl: '/biz/search/dictionary/dict-biz',
      dicHeaders: { crypto: true },
      dicQuery: { code: 'device' },
      dicMethod: 'post',
      dataType: 'number',
      props: {
        label: 'dictValue',
        value: 'dictKey'
      },
      width: 125
    },
    {
      label: '代理平台',
      prop: 'proxyPlatformId',
      type: 'cascader',
      multiple: true,
      dicUrl: '/biz/search/select/task-proxy-platform',
      dicHeaders: { crypto: true },
      dicMethod: 'post',
      dataType: 'string',
      props: {
        label: 'dictValue',
        value: 'dictKey'
      },
      hide: true
    },
    {
      label: '更改设备',
      prop: 'isChangeDevice',
      type: 'select',
      dicData: dict.yes_no,
      dataType: 'number',
      hide: true
    },
    {
      label: '发送次数',
      prop: 'sendRetryCount',
      type: 'number',
      controls: false
    },
    {
      label: '注册重试',
      prop: 'registerRetryCount',
      type: 'number',
      controls: false
    },
    {
      label: '验证码',
      prop: 'code',
      type: 'input',
      hide: true
    },
    {
      label: 'reason',
      prop: 'reason',
      type: 'input',
      overHidden: true,
      search: true,
      searchSpan: 4,
      searchLabelWidth: 90
    },
    {
      label: 'token',
      prop: 'token',
      type: 'input',
      overHidden: true,
      hide: true
    },
    {
      label: '流量(k)',
      prop: 'traffic',
      type: 'input'
    },
    {
      label: '创建时间',
      prop: 'createTime',
      type: 'datetime',
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      startPlaceholder: '开始日期',
      endPlaceholder: '结束日期',
      addDisplay: false,
      editDisplay: false,
      viewDisplay: true,
      search: true,
      searchRange: true,
      searchSpan: 8,
      searchOrder: 99,
      sortable: 'custom',
      width: 180,
      shortcuts: date.shortcuts,
      disabledDate(time) {
        // 禁止选择3个月前的日期
        const threeMonthsAgo = new Date();
        threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);
        // 返回 true 时禁用日期
        return time.getTime() < threeMonthsAgo.getTime();
      }
    },
    {
      label: '修改时间',
      prop: 'updateTime',
      type: 'datetime',
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      startPlaceholder: '开始日期',
      endPlaceholder: '结束日期',
      hide: true,
      addDisplay: false,
      editDisplay: false,
      viewDisplay: true
    },
    {
      label: '状态',
      prop: 'status',
      type: 'select',
      dicUrl: '/biz/search/dictionary/dict-biz',
      dicHeaders: { crypto: true },
      dicQuery: { code: 'sms_phone_status' },
      dicMethod: 'post',
      dataType: 'number',
      props: {
        label: 'dictValue',
        value: 'dictKey'
      },
      value: 1,
      search: true,
      searchSpan: 4,
      searchLabelWidth: 75,
      filterable: true,
      virtualize: true,
      width: 95,
      fixed: 'right'
    }
  ]
};
